<include file="Public:head" title="{$menu.name}"/>

<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li>任务管理</li>
                    <li class="active">{$menu.name}</li>
                </ul>
            </div>
            <div class="page-content">

                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="space-6"></div>

                        <div class="row">
                            <div class="col-sm-10 col-sm-offset-1">
                                <div class="widget-box transparent">
                                    <div class="widget-header widget-header-large">
                                        <h3 class="widget-title grey lighter">
                                            <i class="ace-icon fa fa-leaf green"></i>
                                            任务详情
                                        </h3>

                                        <if condition="$taskdetails.status eq 0">
                                            <div id="progressbar" class="ui-progressbar ui-widget ui-widget-content ui-corner-all progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"><div class="ui-progressbar-value ui-widget-header ui-corner-left progress-bar progress-bar-success" style="width: 00%;"></div></div>

                                            <elseif condition="$taskdetails.status eq 1"/>
                                            <div id="progressbar" class="ui-progressbar ui-widget ui-widget-content ui-corner-all progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"><div class="ui-progressbar-value ui-widget-header ui-corner-left progress-bar progress-bar-success" style="width: 50%;"></div></div>

                                            <elseif condition="$taskdetails.status eq 2"/>
                                            <div id="progressbar" class="ui-progressbar ui-widget ui-widget-content ui-corner-all progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100"><div class="ui-progressbar-value ui-widget-header ui-corner-left progress-bar progress-bar-success" style="width: 100%;"></div></div>

                                            <elseif condition="$taskdetails.status eq 3"/>
                                            <div id="progressbar" class="ui-progressbar ui-widget ui-widget-content ui-corner-all progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100"><div class="ui-progressbar-value ui-widget-header ui-corner-left progress-bar progress-bar-fail" style="width: 100%;"></div></div>

                                            <else />
                                        </if>

                                    </div>

                                    <div class="widget-body">
                                        <div class="widget-main padding-24">
                                            <div class="row">
                                                <div class="col-sm-12">
                                                    <div class="row">
                                                        <div class="col-xs-11 label label-lg label-info arrowed-in arrowed-right">
                                                            <b>任务基本信息</b>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <ul class="list-unstyled spaced">
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>任务名称：{$taskdetails.task_name}
                                                            </li>

                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>订单编号：{$taskdetails.order_no}
                                                            </li>
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>客户qq：{$taskdetails.qq}
                                                            </li>
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>客户手机：{$taskdetails.mobile}
                                                            </li>
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>指派给：{$taskdetails.nickname}
                                                            </li>

                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>
                                                                任务描述
                                                                <b class="red">
                                                                    {$taskdetails.task_content}
                                                                </b>
                                                            </li>

                                                            <li class="divider"></li>

                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>
                                                                创建时间：{$taskdetails.create_time}
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div><!-- /.col -->

                                                <div class="col-sm-12">
                                                    <div class="row">
                                                        <div class="col-xs-11 label label-lg label-success arrowed-in arrowed-right">
                                                            <b>任务追踪</b>
                                                        </div>
                                                    </div>

                                                    <div>
                                                        <ul class="list-unstyled  spaced">
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right green"></i>任务状态：{$taskdetails.status|getTaskstatus} <a onclick="editstatus()">修改</a>
                                                            </li>
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right blue"></i>
                                                                任务描述：
                                                                <b class="red">{$taskdetails.tracking_description}
                                                                </b>
                                                                <a onclick="set_tracking_description(this,{$taskdetails.id})">修改</a>
                                                            </li>
                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right green"></i>处理时间：{$taskdetails.processing_time}
                                                            </li>


                                                            <li>
                                                                <i class="ace-icon fa fa-caret-right green"></i>
                                                                更新时间：{$taskdetails.update_time}
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div><!-- /.col -->
                                            </div><!-- /.row -->




                                            <div class="space-6"></div>

                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div>
        </div>
    </div>
    <style>
        .widget-body{
             height: 500px;
        }
    </style>
    <div class="layer_notice" style="text-align: center;display: none">
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <div class="radio">
<!--                    <label>-->
<!--                        <input name="status" value="0" type="radio" class="ace" <if condition="$taskdetails.status eq 0">checked </if>  >-->
<!--                        <span class="lbl"> 新建</span>-->
<!--                    </label>-->


                    <label>
                        <input name="status" value="1" type="radio" class="ace" <if condition="$taskdetails.status eq 1">checked </if> >
                        <span class="lbl"> 进行中</span>
                    </label>

                    <label>
                        <input name="status" value="2" type="radio" class="ace" <if condition="$taskdetails.status eq 2">checked </if> >
                        <span class="lbl"> 已解决</span>
                    </label>

                    <label>
                        <input name="status" value="3" type="radio" class="ace" <if condition="$taskdetails.status eq 3">checked </if> >
                        <span class="lbl"> 不予受理</span>
                    </label>
                </div>
            </div>
            <button class="btn btn-info btn-sm" onclick="setstatus(this,{$taskdetails.id})" type="button">
                <i class="icon-ok bigger-110 "></i>
                保 存
            </button>
        </div>

    </div>
    <style>
        .layui-input-block .radio label{
             margin-left: 10px;
            line-height: 10px;
        }
        .progress-bar-fail {
            background-color: #e21f33;
        }
    </style>
    <script type="text/javascript" src="/Public/plugins/layer/layer.js"></script>
    <!--    本月-->
    <script>
        function editstatus() {
            layer.open({
                type: 1,
                shade: false,
                title: false, //不显示标题
                area:["300px","200px"],
                content: $('.layer_notice'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                cancel: function(){
                    layer.msg('您关闭了操作', {time: 5000, icon:6});
                }
            });
        }
        
        function setstatus(obj,id) {
            var status = $("input[name='status']:checked").val();
            $.ajax({
                url:"{:U('Taskwork/setstatus')}",
                type:'POST', //GET
                async:true,    //或false,是否异步
                data:{
                    id:id,
                    status:status,
                },
                timeout:5000,
                dataType:'json',
                beforeSend:function(xhr){
                    var index = layer.load()
                },
                success:function(data,textStatus,jqXHR){
                    if(data.code == 200) {
                        layer.closeAll();
                        layer.msg(data.msg);
                        location.reload();
                    }else{
                        layer.closeAll()
                        layer.msg(data.msg);
                    }
                },
                error:function(xhr,textStatus){
                    // console.log('error')
                    // console.log(xhr)
                    // console.log(textStatus)
                },
                complete:function(){
                    // console.log('end')
                }
            });
        }

        function set_tracking_description(obj,id) {
            var  text ="{$taskdetails.tracking_description}";
            layer.prompt({title: '请输入进度描述',  value: text,area: ['600px', '300px'],formType: 2}, function(text, index){
                $.ajax({
                    url:"{:U('Taskwork/settracking')}",
                    type:'POST', //GET
                    async:true,    //或false,是否异步
                    data:{
                        id:id,
                        tracking_description:text,
                    },
                    timeout:5000,    //超时时间
                    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                    beforeSend:function(xhr){
                        var index = layer.load()
                    },
                    success:function(data,textStatus,jqXHR){
                        if(data.code == 200) {
                            layer.closeAll();
                            layer.msg(data.msg);
                            location.reload();
                        }else{
                            layer.closeAll()
                            layer.msg(data.msg);
                        }
                    },
                    error:function(xhr,textStatus){
                        // console.log('error')
                        // console.log(xhr)
                        // console.log(textStatus)
                    },
                    complete:function(){
                        // console.log('end')
                    }
                });
                layer.close(index);
            });
        }
    </script>
</div>
<include file="Public:foot" />  
<include file="Public:date_range" />
<include file="Public:fusioncharts" />

